sgdk: string.h File Reference

sgdk

- Main Page
- Related Pages
- Classes
- Files

- File List
- File Members

Functions
string.h File Reference

String manipulations. More...

Go to the source code of this file.

## Functions

u32 | strlen (const char *str)
| Calculate the length of a string.
s16 | strcmp (const char *str1, const char *str2)
| Compare the 2 strings.
char * | strclr (char *str)
| Clear a string.
char * | strcpy (char *dest, const char *src)
| Copy a string.
char * | strcat (char *dest, const char *src)
| Concatenate two strings.
void | intToStr (s32 value, char *str, s16 minsize)
| Convert a s32 value to string.
void | uintToStr (u32 value, char *str, s16 minsize)
| Convert a u32 value to string.
void | intToHex (u32 value, char *str, s16 minsize)
| Convert a u32 value to hexadecimal string.
void | fix32ToStr (fix32 value, char *str, s16 numdec)
| Convert a fix32 value to string.
void | fix16ToStr (fix16 value, char *str, s16 numdec)
| Convert a fix16 value to string.

## Detailed Description

String manipulations.

Author:
  Stephane Dallongeville

Date:
  08/2011

This unit provides basic null terminated string operations and type conversions.

## Function Documentation

void fix16ToStr | ( | fix16 | value,
|  | char * | str,
|  | s16 | numdec
| ) |  |

Convert a fix16 value to string.

Parameters:

  value | The fix16 value to convert to string.
  str | Destination string (it must be large enough to receive result).
  numdec | Number of wanted decimal.

Converts the specified fix16 value to string.

void fix32ToStr | ( | fix32 | value,
|  | char * | str,
|  | s16 | numdec
| ) |  |

Convert a fix32 value to string.

Parameters:

  value | The fix32 value to convert to string.
  str | Destination string (it must be large enough to receive result).
  numdec | Number of wanted decimal.

Converts the specified fix32 value to string.

void intToHex | ( | u32 | value,
|  | char * | str,
|  | s16 | minsize
| ) |  |

Convert a u32 value to hexadecimal string.

Parameters:

  value | The u32 integer value to convert to hexadecimal string.
  str | Destination string (it must be large enough to receive result).
  minsize | Minimum size of resulting string.

Converts the specified u32 value to hexadecimal string.
If resulting value is shorter than requested minsize the method prepends result with '0' character.

void intToStr | ( | s32 | value,
|  | char * | str,
|  | s16 | minsize
| ) |  |

Convert a s32 value to string.

Parameters:

  value | The s32 integer value to convert to string.
  str | Destination string (it must be large enough to receive result).
  minsize | Minimum size of resulting string.

Converts the specified s32 value to string.
If resulting value is shorter than requested minsize the method prepends result with '0' character.

char* strcat | ( | char * | dest,
|  | const char * | src
| ) |  |

Concatenate two strings.

Parameters:

  dest | Destination string (it must be large enough to receive appending).
  src | Source string.

Returns:
  pointer on destination string.

Appends the source string to the destination string.

char* strclr | ( | char * | str | ) |

Clear a string.

Parameters:

  str | string to clear.

Returns:
  pointer on the given string.

Clear the specified string.

s16 strcmp | ( | const char * | str1,
|  | const char * | str2
| ) |  |

Compare the 2 strings.

Parameters:

  str1 | The string we want to compare.
  str2 | The string we want to compare.

Returns:
  an integral value indicating the relationship between the strings:
  A zero value indicates that both strings are equal.
  A value greater than zero indicates that the first character that does not match has a greater value in str1 than in str2
  A value less than zero indicates the opposite.

This function starts comparing the first character of each string.
If they are equal to each other, it continues with the following pairs until the characters differ or until a terminating null-character is reached.

char* strcpy | ( | char * | dest,
|  | const char * | src
| ) |  |

Copy a string.

Parameters:

  dest | Destination string (it must be large enough to receive the copy).
  src | Source string.

Returns:
  pointer on destination string.

Copies the source string to destination.

u32 strlen | ( | const char * | str | ) |

Calculate the length of a string.

Parameters:

  str | The string we want to calculate the length.

Returns:
  length of string.

This function calculates and returns the length of the specified string.

void uintToStr | ( | u32 | value,
|  | char * | str,
|  | s16 | minsize
| ) |  |

Convert a u32 value to string.

Parameters:

  value | The u32 integer value to convert to string.
  str | Destination string (it must be large enough to receive result).
  minsize | Minimum size of resulting string.

Converts the specified u32 value to string.
If resulting value is shorter than requested minsize the method prepends result with '0' character.

All Classes Files Functions Variables Typedefs Enumerations Defines